I did so:
Controller.prototype.ComponentSelectionPageCallback = function() { var targetDir = gui.pageById(QInstaller.TargetDirectory).TargetDirectoryLineEdit.text; var files = QDesktopServices.findFiles(targetDir, "*.*"); if (files.length!=0) { installer.setValue("TargetDir", targetDir + "\\" + installer.value("ProductName")); } }